{"ast":null,"code":"import _slicedToArray from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import React,{useEffect}from\"react\";import{IconButton,Paper,TextField}from\"@mui/material\";import classNames from\"classnames\";import'./DialogInput.scss';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var DialogInput=function DialogInput(props){var _React$useState=React.useState(false),_React$useState2=_slicedToArray(_React$useState,2),value=_React$useState2[0],setValue=_React$useState2[1];var _React$useState3=React.useState(''),_React$useState4=_slicedToArray(_React$useState3,2),textField=_React$useState4[0],setTextField=_React$useState4[1];var maxSizeMessage=500;useEffect(function(){if(textField.length>0){setValue(true);}else{setValue(false);}},[textField]);return/*#__PURE__*/_jsxs(Paper,{component:\"form\",className:\"dialogInput-form\",children:[/*#__PURE__*/_jsx(IconButton,{type:\"button\",className:\"dialogInput-form-smile\"}),/*#__PURE__*/_jsx(TextField,{className:classNames(\"dialogInput-form-input\",{\"dialogInput-form-input--error\":textField.length>maxSizeMessage}),onChange:function onChange(e){return setTextField(e.target.value);},variant:\"outlined\",label:textField.length>0&&\"\".concat(textField.length,\"/\").concat(maxSizeMessage)||null,multiline:true,rows:textField.length>maxSizeMessage*0.05?3:1,placeholder:\"\\u0412\\u0432\\u0435\\u0434\\u0438\\u0442\\u0435 \\u0441\\u043E\\u043E\\u0431\\u0449\\u0435\\u043D\\u0438\\u0435\",inputProps:{'aria-label':'Введите сообщение'}}),/*#__PURE__*/_jsx(IconButton,{type:\"button\",className:\"dialogInput-form-image\"}),/*#__PURE__*/_jsx(IconButton,{type:\"button\",className:\"dialogInput-form-document\"}),value&&/*#__PURE__*/_jsx(IconButton,{type:\"button\",className:\"dialogInput-form-send\"})||/*#__PURE__*/_jsx(IconButton,{type:\"button\",className:\"dialogInput-form-microphone\"})]});};export default DialogInput;","map":{"version":3,"names":["React","useEffect","IconButton","Paper","TextField","classNames","DialogInput","props","useState","value","setValue","textField","setTextField","maxSizeMessage","length","e","target"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/components/DialogInput/index.tsx"],"sourcesContent":["import React, {useEffect} from \"react\";\nimport {IconButton, Paper, TextField} from \"@mui/material\";\nimport {DialogInputProps} from \"../../models/props/DialogInputProps\";\nimport classNames from \"classnames\";\nimport './DialogInput.scss';\n\nconst DialogInput: React.FC<DialogInputProps> = (props) => {\n    const [value, setValue] = React.useState<boolean>(false);\n    const [textField, setTextField] = React.useState<string>('');\n\n    const maxSizeMessage = 500;\n\n    useEffect(() => {\n        if (textField.length > 0) {\n            setValue(true);\n        } else {\n            setValue(false);\n        }\n    }, [textField]);\n\n        return (\n                <Paper component=\"form\" className=\"dialogInput-form\">\n                        <IconButton\n                            type=\"button\"\n                            className='dialogInput-form-smile'\n                        />\n                        <TextField\n                            className={classNames(\"dialogInput-form-input\", {\n                                \"dialogInput-form-input--error\": textField.length > maxSizeMessage\n                            })}\n                            onChange={e => (setTextField(e.target.value))}\n                            variant=\"outlined\"\n                            label={((textField.length > 0 && `${textField.length}/${maxSizeMessage}`) || null)}\n                            multiline\n                            rows={(textField.length > maxSizeMessage * 0.05)? 3: 1}\n                            placeholder=\"Введите сообщение\"\n                            inputProps={{ 'aria-label': 'Введите сообщение' }}\n                        />\n                        <IconButton\n                            type=\"button\"\n                            className='dialogInput-form-image'\n                        />\n                        <IconButton\n                            type=\"button\"\n                            className='dialogInput-form-document'\n                        />\n                        {\n                            (value &&\n                                <IconButton\n                                    type=\"button\"\n                                    className='dialogInput-form-send'\n                                />) ||\n                                (<IconButton\n                                    type=\"button\"\n                                    className='dialogInput-form-microphone'\n                                />)\n                        }\n            </Paper>\n        );\n}\n\nexport default DialogInput;"],"mappings":"8IAAA,MAAOA,MAAK,EAAGC,SAAS,KAAO,OAAO,CACtC,OAAQC,UAAU,CAAEC,KAAK,CAAEC,SAAS,KAAO,eAAe,CAE1D,MAAOC,WAAU,KAAM,YAAY,CACnC,MAAO,oBAAoB,CAAC,wFAE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